<?php
require_once (APPLICATION_DIR."/application/model/Admin_topmenu.php");
class Admin_topmenu extends DataObjects_Admin_topmenu
{	
	function getMenuTitle()
	{
		$this->selectAdd();
		$this->selectAdd("menu_id,menu_action,menu_title");
		$this->orderBy("menu_id");
		$this->find();
		return $this;
	}
	
	function getMenuInfoByID($menu_id)
	{
		$this->selectAdd();
		$this->selectAdd("menu_id,menu_action,menu_title");
		$this->whereAdd();
		$this->whereAdd("menu_id = $menu_id");
		$this->find();
		return $this;
	}
	
	function prepareTopMenu()
	{
		$smarty 	= DRX::load("smarty");
		
		$menu 		= $this->getMenuTitle();	
		$smarty->assign("menu",$menu);
		
		$submenu	= new Admin_submenu();
		$dropmenu	= $submenu->getAllSubMenu();
		$dropmenu->fetch();
		$smarty->assign("dropmenu",$dropmenu);
	}
	
	function preparePageTitle($menu_id)
	{
		$smarty 	= DRX::load("smarty");
		$info 		= $this->getMenuInfoByID($menu_id);	
		$info->fetch();
		$page_title	= $info->menu_title;
		$smarty->assign("page_title",$page_title);
	}
}
?>